#include "CtxObj.h"

int CtxObj::getMainVersion()
{
	return MAIN_VERSION;
}

int CtxObj::getSubVersion()
{
	return SUB_VERSION;
}

int CtxObj::getAmendmentVersion()
{
	return AMENDMENT_VERSION;
}

int CtxObj::runScript(const std::string& script)
{
	clearError();
	return continueScript(script);
}

int CtxObj::continueScript(const std::string& script)
{
	if(!m_lexAnalyzer.analyze(script))
	{
		m_desire = m_lexAnalyzer.get_expect();
		return RUN_NOTEND;
	}

	m_lexAnalyzer.print_result();
	return RUN_SUCCESS;
}

void CtxObj::clearError()
{
	m_desire.clear();
	m_lexAnalyzer.clear();
}

std::string CtxObj::getDesire()
{
	return m_desire;
}

void CtxObj::reportError(std::ostream& ostr)
{

}